## This file recreates the tables and figures in Sharan Grewal and Matthew Cebul,
## "Can Religious Reinterpretations Bridge the Secular-Religious Divide?
## Experimental Evidence from Tunisia," Journal of Conflict Resolution.
## For any questions, contact ssgrewal@wm.edu.

## Load packages
library(ggplot2)
library(scales)
library(stargazer)
library(sandwich)
library(lmtest)
library(ivreg)

## In our data files, each observation is an individual, not a debate. For
## debate-level analyses, we therefore use duplicated(data$group) to select just one
## individual per pair. For individual-level analyses, we cluster standard errors
## using the function below:

cl  <- function(dat,fm, cluster){
  require(sandwich, quietly = TRUE)
  require(lmtest, quietly = TRUE)
  M <- length(unique(cluster))
  N <- length(cluster)
  K <- fm$rank
  dfc <- (M/(M-1))*((N-1)/(N-K))
  uj  <- apply(estfun(fm),2, function(x) tapply(x, cluster, sum));
  vcovCL <- dfc*sandwich(fm, meat=crossprod(uj)/N)
  coeftest(fm, vcovCL) }


###############
## Load data ##
###############

data <- read.csv("exp1.csv")
data2 <- read.csv("exp2.csv")



##############
## Figure 1 ##
##############

## Experiment 1: Histogram of positions
h <- hist(data$position, plot=F, breaks=0.5:6.5)
h$density <- round(h$counts/sum(h$counts)*100,1)
plot(h, xlim=c(0.5,6.5), main="Positions, Sale of Alcohol (N=240)", freq=F,
     xlab="", labels=TRUE, ylim=c(0, 50), ylab="Percent", col="darkgrey", xaxt="n")
axis(1, at=1:6, labels=c("Allow", "Friday", "Grocery", "Tax", "Muslim", "Ban"))


## Experiment 2: Histogram of positions
h <- hist(data2$position, plot=F, breaks=0.5:6.5)
h$density <- round(h$counts/sum(h$counts)*100,1)
plot(h, xlim=c(0.5,6.5), main="Positions, Female Leadership (N=362)", freq=F,
     xlab="", labels=TRUE, ylim=c(0, 40), ylab="Percent", col="darkgrey", xaxt="n")
axis(1, at=1:6, labels=c("Law", "Eligible", "Not Pres", "Not PM", "Not Gov", "None"))




##############
## Figure 2 ##
##############


## Experiment 1: Main Results

t.test(data$comp[data$treat=="sec-rel" & duplicated(data$group)==TRUE], data$comp[data$treat=="rel-rel"& duplicated(data$group)==TRUE])
t.test(data$comp[data$treat=="sec-sec" & duplicated(data$group)==TRUE], data$comp[data$treat=="rel-rel"& duplicated(data$group)==TRUE])
t.test(data$comp[data$treat!="rel-rel" & duplicated(data$group)==TRUE], data$comp[data$treat=="rel-rel"& duplicated(data$group)==TRUE])

data.summary <- data.frame(
  treatment=c("Secular-Secular", "Secular-Religious", "Religious-Religious"),
  mean=rbind(mean(data$comp[data$treat=="sec-sec"]),
             mean(data$comp[data$treat=="sec-rel"]), mean(data$comp[data$treat=="rel-rel"]))*100,
  n=rbind(length(data$comp[data$treat=="sec-rel"]),
          length(data$comp[data$treat=="sec-rel"]),length(data$comp[data$treat=="rel-rel"])),
  sd=rbind(sd(data$comp[data$treat=="sec-rel"]),
           sd(data$comp[data$treat=="sec-rel"]), sd(data$comp[data$treat=="sec-rel"]))*100
)

data.summary$sem <- data.summary$sd/sqrt(data.summary$n)
data.summary$me <- qt(1-.05/2, df=data.summary$n)*data.summary$sem
data.summary$me84 <- qt(1-.16/2, df=data.summary$n)*data.summary$sem

ggplot(data.summary, 
       aes(x=treatment, y=mean)) +  
  geom_bar(position=position_dodge(width=0.5), stat="identity", 
           fill=c("grey","darkgrey", "cornflowerblue"), size=0.5) + 
  geom_errorbar(aes(ymin=mean-me, ymax=mean+me, width=0.1), size=0.2) +
  geom_errorbar(aes(ymin=mean-me84, ymax=mean+me84, width=0), size=1) +
  ggtitle("Compromise, Sale of Alcohol") +
  theme_bw() + 
  theme(panel.grid.major = element_blank()) + 
  theme(plot.title = element_text(hjust = 0.5)) +
  scale_y_continuous(limits=c(0, 80),breaks=seq(0, 80, by=20),oob=rescale_none) +
  xlab("") +
  ylab("Found Compromise (%)") +
  geom_text(data=data.summary, 
            aes(x=treatment, y=mean,
                label=formatC(round(mean,1),format='f',digits=1)),
            vjust=-4.5,size=5,position=position_dodge(0.9)) +
  theme(text = element_text(size=16))



## Experiment 2: Main Results

t.test(data2$comp[data2$treat=="sec-rel" & duplicated(data2$group)==TRUE], data2$comp[data2$treat=="rel-rel"& duplicated(data2$group)==TRUE])
t.test(data2$comp[data2$treat=="sec-sec" & duplicated(data2$group)==TRUE], data2$comp[data2$treat=="rel-rel"& duplicated(data2$group)==TRUE])
t.test(data2$comp[data2$treat!="rel-rel" & duplicated(data2$group)==TRUE], data2$comp[data2$treat=="rel-rel"& duplicated(data2$group)==TRUE])

data.summary <- data.frame(
  treatment=c("Secular-Secular", "Secular-Religious", "Religious-Religious"),
  mean=rbind(mean(data2$comp[data2$treat=="sec-sec"]),
             mean(data2$comp[data2$treat=="sec-rel"]), mean(data2$comp[data2$treat=="rel-rel"]))*100,
  n=rbind(length(data2$comp[data2$treat=="sec-rel"]),
          length(data2$comp[data2$treat=="sec-rel"]),length(data2$comp[data2$treat=="rel-rel"])),
  sd=rbind(sd(data2$comp[data2$treat=="sec-rel"]),
           sd(data2$comp[data2$treat=="sec-rel"]), sd(data2$comp[data2$treat=="sec-rel"]))*100
)

data.summary$sem <- data.summary$sd/sqrt(data.summary$n)
data.summary$me <- qt(1-.05/2, df=data.summary$n)*data.summary$sem
data.summary$me84 <- qt(1-.16/2, df=data.summary$n)*data.summary$sem


ggplot(data.summary, 
       aes(x=treatment, y=mean)) +  
  geom_bar(position=position_dodge(width=0.5), stat="identity", 
           fill=c("grey","darkgrey", "cornflowerblue"), size=0.5) + 
  geom_errorbar(aes(ymin=mean-me, ymax=mean+me, width=0.1), size=0.2) +
  geom_errorbar(aes(ymin=mean-me84, ymax=mean+me84, width=0), size=1) +
  ggtitle("Compromise, Female Leadership") +
  theme_bw() + 
  theme(panel.grid.major = element_blank()) + 
  theme(plot.title = element_text(hjust = 0.5)) +
  scale_y_continuous(limits=c(0, 80),breaks=seq(0, 80, by=20),oob=rescale_none) +
  xlab("") +
  ylab("Found Compromise (%)") +
  geom_text(data=data.summary, 
            aes(x=treatment, y=mean,
                label=formatC(round(mean,1),format='f',digits=1)),
            vjust=-4.5,size=5,position=position_dodge(0.9)) +
  theme(text = element_text(size=16))



#############
## Table 3 ##
#############

one <- lm(comp~relrel+secsec, data=data[duplicated(data$group)==TRUE,])
two <- lm(comp~relrel+secsec+dist+gender_match+enumveil+wave, data=data[duplicated(data$group)==TRUE,])

test <- data[,c("comp","relrel","secrel","secsec","dist","gender_match","enumveil","wave","age",
                "sex","rel","unemp","student","urban","married","edu","income1","group",
                "intensity", "hear", "position")]
test <- na.omit(test)
three <- lm(comp~relrel+secsec+dist+gender_match+enumveil+wave+age+sex+rel+unemp+student+urban+married+edu+income1+intensity+hear+factor(position), data=test)
summary(three)
cluster <- cl(test, three, test$group)
stargazer(one, two, cluster, single.row=T)



#############
## Table 4 ##
#############

one <- lm(comp~relrel+secsec, data=data2[duplicated(data2$group)==TRUE,])
two <- lm(comp~relrel+secsec+dist+gender_pair+enumgender+enumveil, data=data2[duplicated(data2$group)==TRUE,])
test <- data2[,c("comp","relrel","secrel","secsec","dist","gender_pair","enumgender",
               "enumveil","age","sex","rel","emp","student","urb","married",
               "edu","income","group","intensity", "hear", "position")]
test <- na.omit(test)
three <- lm(comp~relrel+secsec+dist+gender_pair+enumgender+enumveil+age+sex+rel+emp+student+urb+married+edu+income+(income==16)+intensity+hear+factor(position), data=test)
summary(three)
cluster <- cl(test, three, test$group)
stargazer(one, two, cluster, single.row=T)







##############
## Figure 3 ##
##############

## Experiment 1: Liberals

t.test(data$reasonA[data$treat=="rel-rel" & data$wave==2], 
       data$reasonA[data$treat!="rel-rel" & data$wave==2])

data.summary <- data.frame(
  treatment=c("Secular-Secular","Secular-Religious", "Religious-Religious"),
  mean=rbind(mean(data$reasonA[data$treat=="sec-sec" & data$wave==2], na.rm=TRUE),
             mean(data$reasonA[data$treat=="sec-rel" & data$wave==2], na.rm=TRUE), 
             mean(data$reasonA[data$treat=="rel-rel" & data$wave==2], na.rm=TRUE))*100,
  n=rbind(length(data$reasonA[data$treat=="sec-sec" & data$wave==2]),
          length(data$reasonA[data$treat=="sec-rel" & data$wave==2]),
          length(data$reasonA[data$treat=="rel-rel" & data$wave==2])),
  sd=rbind(sd(data$reasonA[data$treat=="sec-sec" & data$wave==2], na.rm=TRUE),
           sd(data$reasonA[data$treat=="sec-rel" & data$wave==2], na.rm=TRUE), 
           sd(data$reasonA[data$treat=="sec-rel" & data$wave==2], na.rm=TRUE))*100
)

data.summary$sem <- data.summary$sd/sqrt(data.summary$n)
data.summary$me <- qt(1-.05/2, df=data.summary$n)*data.summary$sem
data.summary$me84 <- qt(1-.16/2, df=data.summary$n)*data.summary$sem


ggplot(data.summary, 
       aes(x=treatment, y=mean)) +  
  geom_bar(position=position_dodge(width=0.5), stat="identity", 
           fill=c("grey","darkgrey", "cornflowerblue"), size=0.5) + 
  geom_errorbar(aes(ymin=mean-me, ymax=mean+me, width=0.1), size=0.2) +
  geom_errorbar(aes(ymin=mean-me84, ymax=mean+me84, width=0), size=1) +
  ggtitle("Arguments Made by Liberals (Alcohol)") +
  theme_bw() + 
  theme(panel.grid.major = element_blank()) + 
  theme(plot.title = element_text(hjust = 0.5)) +
  scale_y_continuous(limits=c(0, 70),breaks=seq(0, 70, by=20),oob=rescale_none) +
  xlab("") +
  ylab("Religious Arguments (%)") +
  geom_text(data=data.summary, 
            aes(x=treatment, y=mean,
                label=round(mean,2)),
            vjust=-4.5,size=5,position=position_dodge(0.9)) +
  theme(text = element_text(size=16))



## Experiment 2: Liberals

t.test(data2$reasonA[data2$treat=="rel-rel"], data2$reasonA[data2$treat!="rel-rel"])

data.summary <- data.frame(
  treatment=c("Secular-Secular", "Secular-Religious", "Religious-Religious"),
  mean=rbind(mean(data2$reasonA[data2$treat=="sec-sec"], na.rm=TRUE), 
             mean(data2$reasonA[data2$treat=="sec-rel"], na.rm=TRUE),
             mean(data2$reasonA[data2$treat=="rel-rel"], na.rm=TRUE))*100,
  n=rbind(length(data2$reasonA[data2$treat=="sec-sec"]),
          length(data2$reasonA[data2$treat=="sec-rel"]),
          length(data2$reasonA[data2$treat=="rel-rel"])),
  sd=rbind(sd(data2$reasonA[data2$treat=="sec-sec"], na.rm=TRUE), 
           sd(data2$reasonA[data2$treat=="sec-rel"], na.rm=TRUE),
           sd(data2$reasonA[data2$treat=="rel-rel"], na.rm=TRUE))*100
)

data.summary$sem <- data.summary$sd/sqrt(data.summary$n)
data.summary$me <- qt(1-.05/2, df=data.summary$n)*data.summary$sem
data.summary$me84 <- qt(1-.16/2, df=data.summary$n)*data.summary$sem



ggplot(data.summary, 
       aes(x=treatment, y=mean)) +  
  geom_bar(position=position_dodge(width=0.5), stat="identity", 
           fill=c("grey","darkgrey", "cornflowerblue"), size=0.5) + 
  geom_errorbar(aes(ymin=mean-me, ymax=mean+me, width=0.1), size=0.2) +
  geom_errorbar(aes(ymin=mean-me84, ymax=mean+me84, width=0), size=1) +
  ggtitle("Arguments Made by Liberals (Female Leadership)") +
  theme_bw() + 
  theme(panel.grid.major = element_blank()) + 
  theme(plot.title = element_text(hjust = 0.5)) +
  scale_y_continuous(limits=c(0, 60),breaks=seq(0, 60, by=20),oob=rescale_none) +
  xlab("") +
  ylab("Religious Arguments (%)") +
  geom_text(data=data.summary, 
            aes(x=treatment, y=mean,
                label=round(mean,0)),
            vjust=-4.5,size=5,position=position_dodge(0.9)) +
  theme(text = element_text(size=16))


## Table 5: Subsetting by Compliance

tapply(data2$comp, list(data2$treat, data2$complier), mean, na.rm=T)

t.test(data2$comp[data2$treat=="rel-rel" & data2$complier==1], 
       data2$comp[data2$treat!="rel-rel" & data2$complier==1])
t.test(data2$comp[data2$treat=="rel-rel" & data2$complier==0], 
       data2$comp[data2$treat!="rel-rel" & data2$complier==0])


one <- lm(comp~relrel+secsec, data=data2[duplicated(data2$group)==TRUE & data2$complier==1,])
two <- lm(comp~relrel+secsec+dist+gender_pair+enumgender+enumveil, data=data2[duplicated(data2$group)==TRUE & data2$complier==1,])
test <- data2[,c("comp","relrel","secsec","dist","gender_pair","enumgender",
               "enumveil","age","sex","rel","emp","student","urb","married",
               "edu","income","group","intensity", "hear", "position","complier")]
test <- na.omit(test)
three <- lm(comp~relrel+secsec+dist+gender_pair+enumgender+enumveil+age+sex+rel+emp+student+urb+married+edu+income+(income==16)+intensity+hear+factor(position), data=test[test$complier==1,])
cluster <- cl(test, three, test$group[test$complier==1])

four <- lm(comp~relrel+secsec, data=data2[duplicated(data2$group)==TRUE & data2$complier==0,])
five <- lm(comp~relrel+secsec+dist+gender_pair+enumgender+enumveil, data=data2[duplicated(data2$group)==TRUE & data2$complier==0,])
test <- data2[,c("comp","relrel","secsec","dist","gender_pair","enumgender",
               "enumveil","age","sex","rel","emp","student","urb","married",
               "edu","income","group","intensity", "hear", "position","complier")]
test <- na.omit(test)
six <- lm(comp~relrel+secsec+dist+gender_pair+enumgender+enumveil+age+sex+rel+emp+student+urb+married+edu+income+(income==16)+intensity+hear+factor(position), data=test[test$complier==0,])
cluster2 <- cl(test, six, test$group[test$complier==0])

stargazer(one, two, cluster, four, five, cluster2)
summary(three)
summary(six)




##############
## Figure 4 ##
##############

## Fig 4: Mechanism - Conservatives
data.summary <- data.frame(
  treatment=c("Secular-Secular","Secular-Religious", "Religious-Religious",
              "Secular-Secular", "Secular-Religious","Religious-Religious"),
  mean=rbind(mean(data$mech1[data$position<4 & data$treat=="sec-sec"], na.rm=TRUE),
             mean(data$mech1[data$position<4 & data$treat=="sec-rel"], na.rm=TRUE),
             mean(data$mech1[data$position<4 & data$treat=="rel-rel"], na.rm=TRUE),
             mean(data$mech1[data$position>3 & data$treat=="sec-sec"], na.rm=TRUE),
             mean(data$mech1[data$position>3 & data$treat=="sec-rel"], na.rm=TRUE),
             mean(data$mech1[data$position>3 & data$treat=="rel-rel"], na.rm=TRUE)),
  n=rbind(length(data$mech1[data$position<4 & data$treat=="sec-sec"]),
          length(data$mech1[data$position<4 & data$treat=="sec-rel"]),
          length(data$mech1[data$position<4 & data$treat=="rel-rel"]),
          length(data$mech1[data$position>3 & data$treat=="sec-sec"]),
          length(data$mech1[data$position>3 & data$treat=="sec-rel"]),
          length(data$mech1[data$position>3 & data$treat=="rel-rel"])),
  sd=rbind(sd(data$mech1[data$position<4 & data$treat=="sec-sec"], na.rm=TRUE),
           sd(data$mech1[data$position<4 & data$treat=="sec-rel"], na.rm=TRUE),
           sd(data$mech1[data$position<4 & data$treat=="rel-rel"], na.rm=TRUE),
           sd(data$mech1[data$position>3 & data$treat=="sec-sec"], na.rm=TRUE),
           sd(data$mech1[data$position>3 & data$treat=="sec-rel"], na.rm=TRUE),
           sd(data$mech1[data$position>3 & data$treat=="rel-rel"], na.rm=TRUE))
)

data.summary$group <- c("1. Liberal", "1. Liberal", "1. Liberal", "2. Conservative", "2. Conservative", "2. Conservative")

data.summary$sem <- data.summary$sd/sqrt(data.summary$n)
data.summary$me <- qt(1-.05/2, df=data.summary$n)*data.summary$sem
data.summary$me84 <- qt(1-.16/2, df=data.summary$n)*data.summary$se


ggplot(data.summary, 
       aes(x=data.summary$group, y=data.summary$mean, fill=data.summary$treatment)) +  
  geom_bar(position=position_dodge(width=0.9), stat="identity") + 
  geom_errorbar(aes(ymin=mean-me, ymax=mean+me, width=0.2), size=0.2, 
                position=position_dodge(width=0.9)) +
  geom_errorbar(aes(ymin=mean-me84, ymax=mean+me84, width=0), size=1,
                position=position_dodge(width=0.9)) +
  ggtitle("Support for Multiple Interpretations, Alcohol") +
  theme_bw() + 
  theme(panel.grid.major = element_blank()) + 
  theme(plot.title = element_text(hjust = 0.5)) +
  scale_y_continuous(limits=c(1, 5),breaks=seq(1, 5, by=1),oob=rescale_none) +
  xlab("") +
  scale_fill_manual(values = c("cornflowerblue","darkgrey","grey")) +
  labs(fill="") +
  ylab("Support for Differences (1-5)") +
  geom_text(data=data.summary, 
            aes(x=data.summary$group, y=data.summary$mean,
                label=round(data.summary$mean,2)),
            vjust=c(-4,-4,-4,-4,-3,-4),size=5,position=position_dodge(0.9)) +
  theme(text = element_text(size=15))



##############
## Figure 5 ##
##############

## Fig 5: Mechanism - Liberals

data.summary <- data.frame(
  treatment=c("Secular-Secular","Secular-Religious", "Religious-Religious",
              "Secular-Secular","Secular-Religious","Religious-Religious"),
  mean=rbind(mean(data$mech2[data$position<4 & data$treat=="sec-sec"], na.rm=TRUE),
             mean(data$mech2[data$position<4 & data$treat=="sec-rel"], na.rm=TRUE),
             mean(data$mech2[data$position<4 & data$treat=="rel-rel"], na.rm=TRUE),
             mean(data$mech2[data$position>3 & data$treat=="sec-sec"], na.rm=TRUE),
             mean(data$mech2[data$position>3 & data$treat=="sec-rel"], na.rm=TRUE),
             mean(data$mech2[data$position>3 & data$treat=="rel-rel"], na.rm=TRUE)),
  n=rbind(length(data$mech2[data$position<4 & data$treat=="sec-sec"]),
          length(data$mech2[data$position<4 & data$treat=="sec-rel"]),
          length(data$mech2[data$position<4 & data$treat=="rel-rel"]),
          length(data$mech2[data$position>3 & data$treat=="sec-sec"]),
          length(data$mech2[data$position>3 & data$treat=="sec-rel"]),
          length(data$mech2[data$position>3 & data$treat=="rel-rel"])),
  sd=rbind(sd(data$mech2[data$position<4 & data$treat=="sec-sec"], na.rm=TRUE),
           sd(data$mech2[data$position<4 & data$treat=="sec-rel"], na.rm=TRUE),
           sd(data$mech2[data$position<4 & data$treat=="rel-rel"], na.rm=TRUE),
           sd(data$mech2[data$position>3 & data$treat=="sec-sec"], na.rm=TRUE),
           sd(data$mech2[data$position>3 & data$treat=="sec-rel"], na.rm=TRUE),
           sd(data$mech2[data$position>3 & data$treat=="rel-rel"], na.rm=TRUE))
)

data.summary$group <- c("1. Liberal", "1. Liberal", "1. Liberal", "2. Conservative", "2. Conservative", "2. Conservative")
data.summary$sem <- data.summary$sd/sqrt(data.summary$n)
data.summary$me <- qt(1-.05/2, df=data.summary$n)*data.summary$sem
data.summary$me84 <- qt(1-.16/2, df=data.summary$n)*data.summary$se


ggplot(data.summary, 
       aes(x=data.summary$group, y=data.summary$mean, fill=data.summary$treatment)) +  
  geom_bar(position=position_dodge(width=0.9), stat="identity") + 
  geom_errorbar(aes(ymin=mean-me, ymax=mean+me, width=0.2), size=0.2, 
                position=position_dodge(width=0.9)) +
  geom_errorbar(aes(ymin=mean-me84, ymax=mean+me84, width=0), size=1,
                position=position_dodge(width=0.9)) +
  ggtitle("Pressure to Conform, Alcohol") +
  theme_bw() + 
  theme(panel.grid.major = element_blank()) + 
  theme(plot.title = element_text(hjust = 0.5)) +
  scale_y_continuous(limits=c(0, 5),breaks=seq(0, 5, by=1),oob=rescale_none) +
  xlab("") +
  scale_fill_manual(values = c("cornflowerblue", "darkgrey","grey")) +
  labs(fill="") +
  ylab("Level of Agreement (1-5)") +
  geom_text(data=data.summary, 
            aes(x=data.summary$group, y=data.summary$mean,
                label=round(data.summary$mean,2)),
            vjust=c(-4),size=5,position=position_dodge(0.9)) +
  theme(text = element_text(size=16))








##############
## Appendix ##
##############

## Table S1: Representativeness of Laboratory Samples

stargazer(data[c("age40", "sex", "unemp", "student", "urban", "married", 
                 "bach", "income", "rel", "intensity", "hear", "dog_1", "dog_2")],
          data2[c("age40", "sex",  "emp", "student", "urb", "married", 
                "bach", "income", "rel", "intensity", "hear", "dog_1", "dog_2")],
          summary.stat="mean", digits=2)




################
## Appendix B ##
################

## Figure S5: Experiment 1, Covariate Balance, Sec-Sec to Sec-Rel

balance <- as.data.frame(rbind(
  summary(lm(dist~secsec, data=data[data$secrel==0,]))$coef[2,1:2],
  summary(lm(malemale~secsec, data=data[data$secrel==0,]))$coef[2,1:2],
  summary(lm(mixed~secsec, data=data[data$secrel==0,]))$coef[2,1:2],
  summary(lm(enumveil~secsec, data=data[data$secrel==0,]))$coef[2,1:2],
  summary(lm(age/100~secsec, data=data[data$secrel==0,]))$coef[2,1:2],
  summary(lm(sex~secsec, data=data[data$secrel==0,]))$coef[2,1:2],
  summary(lm(rel~secsec, data=data[data$secrel==0,]))$coef[2,1:2],
  summary(lm(emp~secsec, data=data[data$secrel==0,]))$coef[2,1:2],
  summary(lm(student~secsec, data=data[data$secrel==0,]))$coef[2,1:2],
  summary(lm(urban~secsec, data=data[data$secrel==0,]))$coef[2,1:2],
  summary(lm(married~secsec, data=data[data$secrel==0,]))$coef[2,1:2],
  summary(lm(edu~secsec, data=data[data$secrel==0,]))$coef[2,1:2],
  summary(lm(income1~secsec, data=data[data$secrel==0,]))$coef[2,1:2],
  summary(lm(position~secsec, data=data[data$secrel==0,]))$coef[2,1:2],
  summary(lm(intensity~secsec, data=data[data$secrel==0,]))$coef[2,1:2],
  summary(lm(hear~secsec, data=data[data$secrel==0,]))$coef[2,1:2],
  summary(lm(dog_1~secsec, data=data[data$secrel==0,]))$coef[2,1:2],
  summary(lm(dog_2~secsec, data=data[data$secrel==0,]))$coef[2,1:2]
))
balance$name <- c("Ideo. Distance (1-5)", "Male-Male Pair (0-1)", "Mixed Pair (0-1)", 
                  "Veiled Enum (0-1)",
                  "Age/100", "Female (0-1)", "Obs. Piety (0-1)", "Employment (0-1)",
                  "Student (0-1)", "Urban (0-1)", "Married (0-1)", "Education (1-6)", 
                  "Income (0-1)", "Position (1-6)", "Intensity (0-1)", "Hear (0-1)",
                  "Dogmatism 1 (1-5)", "Dogmatism 2 (1-5)")
colnames(balance) <- c("mean", "se", "name")

balance$name <- factor(balance$name, levels=c("Ideo. Distance (1-5)", 
                                              "Male-Male Pair (0-1)", "Mixed Pair (0-1)", "Veiled Enum (0-1)",
                                              "Age/100", "Female (0-1)", "Obs. Piety (0-1)", "Employment (0-1)",
                                              "Student (0-1)", "Urban (0-1)", "Married (0-1)", "Education (1-6)", 
                                              "Income (0-1)", "Position (1-6)", "Intensity (0-1)", "Hear (0-1)",
                                              "Dogmatism 1 (1-5)", "Dogmatism 2 (1-5)"))

balance$name <- factor(balance$name, levels = rev(levels(balance$name)))

ggplot(balance,
       aes(x=balance$mean, y=balance$name)) +
  geom_point(stat="identity", position="identity") +
  geom_errorbarh(aes(xmin=balance$mean-1.96*balance$se, 
                     xmax=balance$mean+1.96*balance$se, height=0.5), size=0.2) +
  geom_vline(aes(xintercept=0)) +
  ggtitle("Balance Plot") +
  theme_bw() + 
  theme(panel.grid.major = element_blank()) + 
  theme(plot.title = element_text(hjust = 0.5)) +
  xlab("Secular-Secular - Religious-Religious") +
  ylab("") +
  scale_x_continuous(limits=c(-1.2, 1.2),breaks=round(seq(-1.2, 1.2, by=0.4),1)) +
  theme(text = element_text(size=17))


## Figure S6: Experiment 1, Covariate Balance, SecRel to RelRel, Alcohol
balance <- as.data.frame(rbind(
  summary(lm(dist~relrel, data=data[data$secsec==0,]))$coef[2,1:2],
  summary(lm(malemale~relrel, data=data[data$secsec==0,]))$coef[2,1:2],
  summary(lm(mixed~relrel, data=data[data$secsec==0,]))$coef[2,1:2],
  summary(lm(enumveil~relrel, data=data[data$secsec==0,]))$coef[2,1:2],
  summary(lm(age/100~relrel, data=data[data$secsec==0,]))$coef[2,1:2],
  summary(lm(sex~relrel, data=data[data$secsec==0,]))$coef[2,1:2],
  summary(lm(rel~relrel, data=data[data$secsec==0,]))$coef[2,1:2],
  summary(lm(emp~relrel, data=data[data$secsec==0,]))$coef[2,1:2],
  summary(lm(student~relrel, data=data[data$secsec==0,]))$coef[2,1:2],
  summary(lm(urban~relrel, data=data[data$secsec==0,]))$coef[2,1:2],
  summary(lm(married~relrel, data=data[data$secsec==0,]))$coef[2,1:2],
  summary(lm(edu~relrel, data=data[data$secsec==0,]))$coef[2,1:2],
  summary(lm(income1~relrel, data=data[data$secsec==0,]))$coef[2,1:2],
  summary(lm(position~relrel, data=data[data$secsec==0,]))$coef[2,1:2],
  summary(lm(intensity~relrel, data=data[data$secsec==0,]))$coef[2,1:2],
  summary(lm(hear~relrel, data=data[data$secsec==0,]))$coef[2,1:2],
  summary(lm(dog_1~relrel, data=data[data$secsec==0,]))$coef[2,1:2],
  summary(lm(dog_2~relrel, data=data[data$secsec==0,]))$coef[2,1:2]
))

balance$name <- c("Ideo. Distance (1-5)", "Male-Male Pair (0-1)", "Mixed Pair (0-1)", 
                  "Veiled Enum (0-1)",
                  "Age/100", "Female (0-1)", "Obs. Piety (0-1)", "Employment (0-1)",
                  "Student (0-1)", "Urban (0-1)", "Married (0-1)", "Education (1-6)", 
                  "Income (0-1)", "Position (1-6)", "Intensity (0-1)", "Hear (0-1)",
                  "Dogmatism 1 (1-5)", "Dogmatism 2 (1-5)")
colnames(balance) <- c("mean", "se", "name")

balance$name <- factor(balance$name, levels=c("Ideo. Distance (1-5)", 
                                              "Male-Male Pair (0-1)", "Mixed Pair (0-1)", "Veiled Enum (0-1)",
                                              "Age/100", "Female (0-1)", "Obs. Piety (0-1)", "Employment (0-1)",
                                              "Student (0-1)", "Urban (0-1)", "Married (0-1)", "Education (1-6)", 
                                              "Income (0-1)", "Position (1-6)", "Intensity (0-1)", "Hear (0-1)",
                                              "Dogmatism 1 (1-5)", "Dogmatism 2 (1-5)"))

balance$name <- factor(balance$name, levels = rev(levels(balance$name)))


ggplot(balance,
       aes(x=balance$mean, y=balance$name)) +
  geom_point(stat="identity", position="identity") +
  geom_errorbarh(aes(xmin=balance$mean-1.96*balance$se, 
                     xmax=balance$mean+1.96*balance$se, height=0.5), size=0.2) +
  geom_vline(aes(xintercept=0)) +
  ggtitle("Balance Plot") +
  theme_bw() + 
  theme(panel.grid.major = element_blank()) + 
  theme(plot.title = element_text(hjust = 0.5)) +
  xlab("Religious-Religious - Secular-Religious") +
  ylab("") +
  scale_x_continuous(limits=c(-1.2, 1.2),breaks=round(seq(-1.2, 1.2, by=0.4),1)) +
  theme(text = element_text(size=17))





## Figure S7: Experiment 1, Initial Positions
data.summary <- cbind(tapply(data$statedA, data$treat, mean, na.rm=TRUE),
                      tapply(data$statedB, data$treat, mean, na.rm=TRUE))

par(mar=c(5,8,5,5))
plot(x=data.summary[,1], y=c(1,2,3), ylim=c(0.5, 3.5), xlim=c(1,6), yaxt="n", ylab="",
     xlab="Initial Position (1-6)", main="Initial Positions by Treatment Group", 
     pch=23, bg="Blue")
points(y=c(1,2,3), x=data.summary[,2], pch=23, bg="Green")
abline(h=c(1,2,3), col="gray")
axis(2, at=1:3, labels=c("Religious-\nReligious", "Secular-\nReligious", "Secular-\nSecular"),
     par(las=1))


## Figure S8: Experiment 1, Initial and compromise positions
data.summary <- cbind(tapply(data$statedA[data$comp==1], data$treat[data$comp==1], 
                             mean, na.rm=TRUE),
                      tapply(data$comppos[data$comp==1], data$treat[data$comp==1], mean, na.rm=TRUE),
                      tapply(data$statedB[data$comp==1], data$treat[data$comp==1], mean, na.rm=TRUE))

par(mar=c(5,8,5,5))
plot(x=data.summary[,1], y=c(1,2,3), ylim=c(0.5, 3.5), xlim=c(1,6), yaxt="n", ylab="",
     xlab="Position (1-6)", main="Initial and Compromise Positions", 
     pch=23, bg="Blue")
points(y=c(1,2,3), x=data.summary[,2], pch=23, bg="Red")
points(y=c(1,2,3), x=data.summary[,3], pch=23, bg="Green")
abline(h=c(1,2,3), col="gray")
axis(2, at=1:3, labels=c("Religious-\nReligious", "Secular-\nReligious", "Secular-\nSecular"),
     par(las=1))




## Table 2: Experiment 1, Robustness check (using control 2)
one <- lm(comp~relrel+secrel, data=data[duplicated(data$group)==TRUE,])
two <- lm(comp~relrel+secrel+dist+gender_match+enumveil+wave, data=data[duplicated(data$group)==TRUE,])
test <- data[,c("comp","relrel","secrel","secsec","dist","gender_match","enumveil","wave","age",
                "sex","rel","unemp","student","urban","married","edu","income1","group",
                "intensity", "hear", "position")]
test <- na.omit(test)
three <- lm(comp~relrel+secrel+dist+gender_match+enumveil+wave+age+sex+rel+unemp+student+urban+married+edu+income1+intensity+hear+factor(position), data=test)
cluster <- cl(test, three, test$group)
stargazer(one, two, cluster, single.row=T)

## Table 3: Experiment 1, Robustness check (using both controls pooled)
one <- lm(comp~relrel, data=data[duplicated(data$group)==TRUE,])
two <- lm(comp~relrel+dist+gender_match+enumveil+wave, data=data[duplicated(data$group)==TRUE,])
three <- lm(comp~relrel+dist+gender_match+enumveil+wave+age+sex+rel+unemp+student+urban+married+edu+income1+intensity+hear+factor(position), data=test)
cluster <- cl(test, three, test$group)
stargazer(one, two, cluster, single.row=T)
summary(three)




## Figure S9: Experiment 1: Conservative Compliers

t.test(data$reasonB[data$treat=="sec-sec" & data$wave==2], 
       data$reasonB[data$treat=="sec-rel" & data$wave==2])

t.test(data$reasonB[data$treat=="sec-sec" & data$wave==2], 
       data$reasonB[data$treat!="sec-sec" & data$wave==2])


data.summary <- data.frame(
  treatment=c("Secular-Secular", "Secular-Religious","Religious-Religious"),
  mean=rbind(mean(data$reasonB[data$treat=="sec-sec" & data$wave==2], na.rm=TRUE), 
             mean(data$reasonB[data$treat=="sec-rel" & data$wave==2], na.rm=TRUE),
             mean(data$reasonB[data$treat=="rel-rel" & data$wave==2], na.rm=TRUE))*100,
  n=rbind(length(data$reasonB[data$treat=="sec-sec" & data$wave==2]),
          length(data$reasonB[data$treat=="sec-rel" & data$wave==2]),
          length(data$reasonB[data$treat=="rel-rel" & data$wave==2])),
  sd=rbind(sd(data$reasonB[data$treat=="sec-sec" & data$wave==2], na.rm=TRUE), 
           sd(data$reasonB[data$treat=="sec-rel" & data$wave==2], na.rm=TRUE),
           sd(data$reasonB[data$treat=="rel-rel" & data$wave==2], na.rm=TRUE))*100
)

data.summary$sem <- data.summary$sd/sqrt(data.summary$n)
data.summary$me <- qt(1-.05/2, df=data.summary$n)*data.summary$sem
data.summary$me84 <- qt(1-.16/2, df=data.summary$n)*data.summary$sem

ggplot(data.summary, 
       aes(x=treatment, y=mean)) +  
  geom_bar(position=position_dodge(width=0.5), stat="identity", 
           fill=c("grey", "grey", "grey"), size=0.5) + 
  geom_errorbar(aes(ymin=mean-me, ymax=mean+me, width=0.1), size=0.2) +
  geom_errorbar(aes(ymin=mean-me84, ymax=mean+me84, width=0), size=1) +
  ggtitle("Arguments Made by Conservatives (Alcohol)") +
  theme_bw() + 
  theme(panel.grid.major = element_blank()) + 
  theme(plot.title = element_text(hjust = 0.5)) +
  scale_y_continuous(limits=c(0, 100),breaks=seq(0, 100, by=20),oob=rescale_none) +
  xlab("") +
  ylab("Religious Arguments (%)") +
  geom_text(data=data.summary, 
            aes(x=treatment, y=mean,
                label=round(mean,2)),
            vjust=-4.5,size=5,position=position_dodge(0.9)) +
  theme(text = element_text(size=16))



## Table S4: Mechanisms, Religious-Religious, Alcohol
one <- lm(mech1~relrel, data=data[data$secsec==0 & data$position>3,])
two <- lm(mech2~relrel, data=data[data$secsec==0 & data$position<4,])
stargazer(one, two)





################
## Appendix B ##
################

## Figure S10: Experiment 2, Covariate Balance, Sec-Sec to Sec-Rel

balance <- as.data.frame(rbind(
  summary(lm(dist~secsec, data=data2[data2$secrel==0,]))$coef[2,1:2],
  summary(lm(malemale~secsec, data=data2[data2$secrel==0,]))$coef[2,1:2],
  summary(lm(mixed~secsec, data=data2[data2$secrel==0,]))$coef[2,1:2],
  summary(lm(enumveil~secsec, data=data2[data2$secrel==0,]))$coef[2,1:2],
  summary(lm(age/100~secsec, data=data2[data2$secrel==0,]))$coef[2,1:2],
  summary(lm(sex~secsec, data=data2[data2$secrel==0,]))$coef[2,1:2],
  summary(lm(rel~secsec, data=data2[data2$secrel==0,]))$coef[2,1:2],
  summary(lm(emp~secsec, data=data2[data2$secrel==0,]))$coef[2,1:2],
  summary(lm(student~secsec, data=data2[data2$secrel==0,]))$coef[2,1:2],
  summary(lm(urban~secsec, data=data2[data2$secrel==0,]))$coef[2,1:2],
  summary(lm(married~secsec, data=data2[data2$secrel==0,]))$coef[2,1:2],
  summary(lm(edu~secsec, data=data2[data2$secrel==0,]))$coef[2,1:2],
  summary(lm(income1~secsec, data=data2[data2$secrel==0,]))$coef[2,1:2],
  summary(lm(position~secsec, data=data2[data2$secrel==0,]))$coef[2,1:2],
  summary(lm(intensity~secsec, data=data2[data2$secrel==0,]))$coef[2,1:2],
  summary(lm(hear~secsec, data=data2[data2$secrel==0,]))$coef[2,1:2],
  summary(lm(dog_1~secsec, data=data2[data2$secrel==0,]))$coef[2,1:2],
  summary(lm(dog_2~secsec, data=data2[data2$secrel==0,]))$coef[2,1:2]
))
balance$name <- c("Ideo. Distance (1-5)", "Male-Male Pair (0-1)", "Mixed Pair (0-1)", 
                  "Veiled Enum (0-1)",
                  "Age/100", "Female (0-1)", "Obs. Piety (0-1)", "Employment (0-1)",
                  "Student (0-1)", "Urban (0-1)", "Married (0-1)", "Education (1-6)", 
                  "Income (0-1)", "Position (1-6)", "Intensity (0-1)", "Hear (0-1)",
                  "Dogmatism 1 (1-5)", "Dogmatism 2 (1-5)")
colnames(balance) <- c("mean", "se", "name")

balance$name <- factor(balance$name, levels=c("Ideo. Distance (1-5)", 
                                              "Male-Male Pair (0-1)", "Mixed Pair (0-1)", "Veiled Enum (0-1)",
                                              "Age/100", "Female (0-1)", "Obs. Piety (0-1)", "Employment (0-1)",
                                              "Student (0-1)", "Urban (0-1)", "Married (0-1)", "Education (1-6)", 
                                              "Income (0-1)", "Position (1-6)", "Intensity (0-1)", "Hear (0-1)",
                                              "Dogmatism 1 (1-5)", "Dogmatism 2 (1-5)"))

balance$name <- factor(balance$name, levels = rev(levels(balance$name)))

ggplot(balance,
       aes(x=balance$mean, y=balance$name)) +
  geom_point(stat="identity", position="identity") +
  geom_errorbarh(aes(xmin=balance$mean-1.96*balance$se, 
                     xmax=balance$mean+1.96*balance$se, height=0.5), size=0.2) +
  geom_vline(aes(xintercept=0)) +
  ggtitle("Balance Plot") +
  theme_bw() + 
  theme(panel.grid.major = element_blank()) + 
  theme(plot.title = element_text(hjust = 0.5)) +
  xlab("Secular-Secular - Religious-Religious") +
  ylab("") +
  scale_x_continuous(limits=c(-1.2, 1.2),breaks=round(seq(-1.2, 1.2, by=0.4),1)) +
  theme(text = element_text(size=17))


## Figure S11: Experiment 2, Covariate Balance, SecRel to RelRel
balance <- as.data.frame(rbind(
  summary(lm(dist~relrel, data=data2[data2$secsec==0,]))$coef[2,1:2],
  summary(lm(malemale~relrel, data=data2[data2$secsec==0,]))$coef[2,1:2],
  summary(lm(mixed~relrel, data=data2[data2$secsec==0,]))$coef[2,1:2],
  summary(lm(enumveil~relrel, data=data2[data2$secsec==0,]))$coef[2,1:2],
  summary(lm(age/100~relrel, data=data2[data2$secsec==0,]))$coef[2,1:2],
  summary(lm(sex~relrel, data=data2[data2$secsec==0,]))$coef[2,1:2],
  summary(lm(rel~relrel, data=data2[data2$secsec==0,]))$coef[2,1:2],
  summary(lm(emp~relrel, data=data2[data2$secsec==0,]))$coef[2,1:2],
  summary(lm(student~relrel, data=data2[data2$secsec==0,]))$coef[2,1:2],
  summary(lm(urban~relrel, data=data2[data2$secsec==0,]))$coef[2,1:2],
  summary(lm(married~relrel, data=data2[data2$secsec==0,]))$coef[2,1:2],
  summary(lm(edu~relrel, data=data2[data2$secsec==0,]))$coef[2,1:2],
  summary(lm(income1~relrel, data=data2[data2$secsec==0,]))$coef[2,1:2],
  summary(lm(position~relrel, data=data2[data2$secsec==0,]))$coef[2,1:2],
  summary(lm(intensity~relrel, data=data2[data2$secsec==0,]))$coef[2,1:2],
  summary(lm(hear~relrel, data=data2[data2$secsec==0,]))$coef[2,1:2],
  summary(lm(dog_1~relrel, data=data2[data2$secsec==0,]))$coef[2,1:2],
  summary(lm(dog_2~relrel, data=data2[data2$secsec==0,]))$coef[2,1:2]
))

balance$name <- c("Ideo. Distance (1-5)", "Male-Male Pair (0-1)", "Mixed Pair (0-1)", 
                  "Veiled Enum (0-1)",
                  "Age/100", "Female (0-1)", "Obs. Piety (0-1)", "Employment (0-1)",
                  "Student (0-1)", "Urban (0-1)", "Married (0-1)", "Education (1-6)", 
                  "Income (0-1)", "Position (1-6)", "Intensity (0-1)", "Hear (0-1)",
                  "Dogmatism 1 (1-5)", "Dogmatism 2 (1-5)")
colnames(balance) <- c("mean", "se", "name")

balance$name <- factor(balance$name, levels=c("Ideo. Distance (1-5)", 
                                              "Male-Male Pair (0-1)", "Mixed Pair (0-1)", "Veiled Enum (0-1)",
                                              "Age/100", "Female (0-1)", "Obs. Piety (0-1)", "Employment (0-1)",
                                              "Student (0-1)", "Urban (0-1)", "Married (0-1)", "Education (1-6)", 
                                              "Income (0-1)", "Position (1-6)", "Intensity (0-1)", "Hear (0-1)",
                                              "Dogmatism 1 (1-5)", "Dogmatism 2 (1-5)"))

balance$name <- factor(balance$name, levels = rev(levels(balance$name)))

ggplot(balance,
       aes(x=balance$mean, y=balance$name)) +
  geom_point(stat="identity", position="identity") +
  geom_errorbarh(aes(xmin=balance$mean-1.96*balance$se, 
                     xmax=balance$mean+1.96*balance$se, height=0.5), size=0.2) +
  geom_vline(aes(xintercept=0)) +
  ggtitle("Balance Plot") +
  theme_bw() + 
  theme(panel.grid.major = element_blank()) + 
  theme(plot.title = element_text(hjust = 0.5)) +
  xlab("Religious-Religious - Secular-Religious") +
  ylab("") +
  scale_x_continuous(limits=c(-1.2, 1.2),breaks=round(seq(-1.2, 1.2, by=0.4),1)) +
  theme(text = element_text(size=17))



## Figure S12: Experiment 2, Initial position plot
data.summary <- cbind(tapply(data2$statedA, data2$treat, mean, na.rm=TRUE),
                      tapply(data2$statedB, data2$treat, mean, na.rm=TRUE))

par(mar=c(5,8,5,5))
plot(x=data.summary[,1], y=c(1,2,3), ylim=c(0.5, 3.5), xlim=c(1,6), yaxt="n", ylab="",
     xlab="Initial Position (1-6)", main="Initial Positions, Female Leadership", 
     pch=23, bg="Blue")
points(y=c(1,2,3), x=data.summary[,2], pch=23, bg="Green")
abline(h=c(1,2,3), col="gray")
axis(2, at=1:3, labels=c("Religious-\nReligious", "Secular-\nReligious", "Secular-\nSecular"),
     par(las=1))


## Figure S13: Experiment 2, Initial and Compromise position plot
data.summary <- cbind(tapply(data2$statedA[data2$comp==1], data2$treat[data2$comp==1], 
                             mean, na.rm=TRUE),
                      tapply(data2$comppos[data2$comp==1], data2$treat[data2$comp==1], mean, na.rm=TRUE),
                      tapply(data2$statedB[data2$comp==1], data2$treat[data2$comp==1], mean, na.rm=TRUE))

par(mar=c(5,8,5,5))
plot(x=data.summary[,1], y=c(1,2,3), ylim=c(0.5, 3.5), xlim=c(1,6), yaxt="n", ylab="",
     xlab="Position (1-6)", main="Initial and Compromise Positions, Female Leadership", 
     pch=23, bg="Blue")
points(y=c(1,2,3), x=data.summary[,2], pch=23, bg="Red")
points(y=c(1,2,3), x=data.summary[,3], pch=23, bg="Green")
abline(h=c(1,2,3), col="gray")
axis(2, at=1:3, labels=c("Religious-\nReligious", "Secular-\nReligious", "Secular-\nSecular"),
     par(las=1))



## Table S5: Experiment 2, Robustness check (using control 2)
one <- lm(comp~relrel+secrel, data=data2[duplicated(data2$group)==TRUE,])
two <- lm(comp~relrel+secrel+dist+gender_pair+enumgender+enumveil, data=data2[duplicated(data2$group)==TRUE,])
test <- data2[,c("comp","relrel","secrel","secsec","dist","gender_pair","enumgender",
               "enumveil","age","sex","rel","emp","student","urb","married",
               "edu","income","group","intensity", "hear", "position")]
test <- na.omit(test)
three <- lm(comp~relrel+secrel+dist+gender_pair+enumgender+enumveil+age+sex+rel+emp+student+urb+married+edu+income+(income==16)+intensity+hear+factor(position), data=test)
cluster <- cl(test, three, test$group)
stargazer(one, two, cluster, single.row=T)
summary(three)

## Table S6: Experiment 2: Experiment 2, robustness check (both controls pooled)
one <- lm(comp~relrel, data=data2[duplicated(data2$group)==TRUE,])
two <- lm(comp~relrel+dist+gender_pair+enumgender+enumveil, data=data2[duplicated(data2$group)==TRUE,])
three <- lm(comp~relrel+dist+gender_pair+enumgender+enumveil+age+sex+rel+emp+student+urb+married+edu+income+(income==16)+intensity+hear+factor(position), data=test)
cluster <- cl(test, three, test$group)
stargazer(one, two, cluster, single.row=T)
summary(three)


## Figure S14: Experiment 2, Conservative Compliers

t.test(data2$reasonB[data2$treat=="sec-sec"], data2$reasonB[data2$treat!="sec-sec"])
t.test(data2$reasonB[data2$treat=="sec-sec"], data2$reasonB[data2$treat=="sec-rel"])

data.summary <- data.frame(
  treatment=c("Secular-Secular", "Secular-Religious", "Religious-Religious"),
  mean=rbind(mean(data2$reasonB[data2$treat=="sec-sec"], na.rm=TRUE), 
             mean(data2$reasonB[data2$treat=="sec-rel"], na.rm=TRUE),
             mean(data2$reasonB[data2$treat=="rel-rel"], na.rm=TRUE))*100,
  n=rbind(length(data2$reasonB[data2$treat=="sec-sec"]),
          length(data2$reasonB[data2$treat=="sec-rel"]),
          length(data2$reasonB[data2$treat=="rel-rel"])),
  sd=rbind(sd(data2$reasonB[data2$treat=="sec-sec"], na.rm=TRUE), 
           sd(data2$reasonB[data2$treat=="sec-rel"], na.rm=TRUE),
           sd(data2$reasonB[data2$treat=="rel-rel"], na.rm=TRUE))*100
)

data.summary$sem <- data.summary$sd/sqrt(data.summary$n)
data.summary$me <- qt(1-.05/2, df=data.summary$n)*data.summary$sem
data.summary$me84 <- qt(1-.16/2, df=data.summary$n)*data.summary$sem

ggplot(data.summary, 
       aes(x=treatment, y=mean)) +  
  geom_bar(position=position_dodge(width=0.5), stat="identity", 
           fill=c("grey","grey", "grey"), size=0.5) + 
  geom_errorbar(aes(ymin=mean-me, ymax=mean+me, width=0.1), size=0.2) +
  geom_errorbar(aes(ymin=mean-me84, ymax=mean+me84, width=0), size=1) +
  ggtitle("Arguments by Conservatives (Female Leadership)") +
  theme_bw() + 
  theme(panel.grid.major = element_blank()) + 
  theme(plot.title = element_text(hjust = 0.5)) +
  scale_y_continuous(limits=c(0, 70),breaks=seq(0, 60, by=20),oob=rescale_none) +
  xlab("") +
  ylab("Religious Arguments (%)") +
  geom_text(data=data.summary, 
            aes(x=treatment, y=mean,
                label=round(mean,0)),
            vjust=-4.5,size=5,position=position_dodge(0.9)) +
  theme(text = element_text(size=16))


## Table S7: Experiment 2, Subsetting by Compliace
tapply(data2$comp, list(data2$treat, data2$complier), mean, na.rm=T)


## Table S8: Experiment 2, Instrumental Variables Approach
one <- ivreg(comp~relrel_r  | relrel, data=data2[duplicated(data2$group)==TRUE,])
summary(one)

two <- ivreg(comp~relrel_r+dist+gender_pair+enumgender+enumveil  | 
                relrel+dist+gender_pair+enumgender+enumveil, 
              data=data2[duplicated(data2$group)==TRUE,])
summary(two)

test <- data2[,c("comp","relrel","secsec","dist","gender_pair","enumgender",
               "enumveil","age","sex","rel","emp","student","urb","married",
               "edu","income","group","intensity", "hear", "position","relrel_r")]
test <- na.omit(test)

three <- ivreg(comp~relrel_r+dist+gender_pair+enumgender+enumveil+age+sex+rel+emp+student+urb+married+edu+income+(income==16)+intensity+hear+position  | 
                 relrel+dist+gender_pair+enumgender+enumveil+age+sex+rel+emp+student+urb+married+edu+income+(income==16)+intensity+hear+position, data=test)
summary(three)
cluster <- cl(test, three, test$group)
cluster



## Table S9: Mechanisms, Religious-Religious, Female Leadership
one <- lm(mech1~relrel, data=data2[data2$secsec==0 & data2$position>2,])
two <- lm(mech2~relrel, data=data2[data2$secsec==0 & data2$position<3,])
stargazer(one, two)



